<!DOCTYPE html>
<html class="pixel-ratio-1">

    <head>
        <title>我的</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

        <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">

        <link rel="stylesheet" href="/static/lib/weui.min.css">
        <link rel="stylesheet" href="/static/css/jquery-weui.css">
        <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
        <style>
            /*头像*/
            #login {
                background: -webkit-linear-gradient(left, #FE9720, #FF7E00); /* Safari 5.1 - 6.0 */
                background: -o-linear-gradient(right, #FE9720, #C74E24); /* Opera 11.1 - 12.0 */
                background: -moz-linear-gradient(right, #FE9720, #E6442B); /* Firefox 3.6 - 15 */
                background: linear-gradient(to right, #fe9720, #e9692c); /* 标准的语法（必须放在最后） */
            }

            /*字体 标题*/
            .body {
                font-family: "Microsoft YaHei", 微软雅黑, "Microsoft JhengHei", 华文细黑, STHeiti, MingLiu
            }

            a:visited {
                color: #000000;
                text-decoration: none;
            }

            a:active {
                color: #000000;
                text-decoration: none;
            }
        </style>
    </head>
    <body ontouchstart class="layui-form body">
        <!--主页-->
        <div style="margin: 15px;border-radius: 10px;" class="layui-row" id="login">
            <!--默认头像-->
            <div class="weui-flex" style="padding: 10px">
                <div class="weui-flex__item">
                    <form id="userInfoForm" method="post" action="/myPage/myInfo">
                        <input type="hidden" name="token" class="token" value=""/>
                        <a href="javascript:;" onclick="document.getElementById('userInfoForm').submit();">
                            <img id="headImg" style="width: 54px ;height: 54px; border-radius: 50%;"
                                 src="/static/images/ToolIoc/星速外卖.png">
                            <div id="nickname"
                                 style="font-weight: 900;font-size: 14px;display: inline-block;margin-left: 5%;color: #000;">
                                昵称
                            </div>
                        </a>
                    </form>
                </div>
                <div id="loginRegister" class="weui-flex__item" style="padding: 16px 0 0 0;">

                    <form id="loginForm" method="post" action="/myPage/login">
                        <input type="hidden" name="token" value=localStorage.getItem('token')/>
                        <a href="javascript:;" onclick="document.getElementById('loginForm').submit();">
                            <span style="font-weight: 900"> 注册/登录</span>
                        </a>
                    </form>
                </div>
                <div style="display: inline-block ; padding: 12px 15px 0 0">
                    <a href="/index/setting">
                        <img width="25" height="25" src="/static/images/ToolIoc/设置.png">
                    </a>
                </div>
            </div>
        </div>
        <!--我的功能-->
        <div class="layui-panel" style="margin: 15px;border-radius: 10px;">
            <div class="weui-flex" style="padding: 5px">
                <div class="weui-flex__item"><span style="font-weight: 900;font-size: 16px">我的功能</span></div>
            </div>
            <div class="weui-flex" style="padding: 15px">
                <div class="weui-flex__item">
                    <img width="32" height="32" style="padding-left: 8%" src="/static/images/ToolIoc/地址.png">
                    <div style="padding-left: 3%">
                        <span style="font-size: 12px">我的地址</span>
                    </div>
                </div>
                <div class="weui-flex__item">
                    <img width="32" height="32" style="padding-left: 8%" src="/static/images/ToolIoc/我的评价.png">
                    <div style="padding-left: 3%">
                        <span style="font-size: 12px">我的评价</span>
                    </div>
                </div>
                <div style="display: inline-block">
                    <img width="32" height="32" style="padding-left: 13%" src="/static/images/ToolIoc/垃圾分类.png">
                    <div>
                        <span style="font-size: 12px">垃圾分类</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-panel" style="margin: 15px;border-radius: 10px;">
            <div class="weui-flex" style="padding: 5px">
                <div class="weui-flex__item"><span style="font-weight: 900;font-size: 16px">我的服务</span></div>
            </div>
            <div class="weui-flex" style="padding: 15px">
                <div class="weui-flex__item">
                    <img width="32" height="32" style="padding-left: 8%" src="/static/images/ToolIoc/帮助与反馈.png">
                    <div style="padding-left: 3%">
                        <span style="font-size: 12px">帮助与反馈</span>
                    </div>
                </div>
                <div class="weui-flex__item" id="shopInfo">
                    <img width="32" height="32" style="padding-left: 8%" src="/static/images/ToolIoc/申请入驻.png">
                    <div style="padding-left: 3%">
                        <span id="role" style="font-size: 12px">商家入驻</span>
                    </div>
                </div>
                <div style="display: inline-block">
                    <img width="32" height="32" style="padding-left: 13%" src="/static/images/ToolIoc/垃圾分类.png">
                    <div>
                        <span style="font-size: 12px">垃圾分类</span>
                    </div>
                </div>
            </div>
        </div>
        <!-- 底部导航 -->
        <div class="weui-tabbar">

        </div>
        <script type='text/javascript' src="/static/lib/jquery-2.1.4.js"></script>
        <script type='text/javascript' src="/static/lib/fastclick.js"></script>
        <script type='text/javascript' src="/static/js/jquery-weui.js"></script>
        <script type='text/javascript' src="/static/layui/layui.js"></script>
        <!--底部导航-->
        <script src="/static/js/baseJs/base.js"></script>
        <script>
            /*颜色图标*/
            $(function () {
                var find = $('.weui-tabbar__item');
                for (let i = 0; i < find.length; i++) {
                    if (i === find.length - 1) {
                        $(find[i]).addClass('weui-bar__item--on')
                        break;
                    }
                    $(find[i]).removeClass('weui-bar__item--on')
                }
            })
        </script>
        <!--方法-->
        <script>
            //初始化
            initMy()
            // /*判断是否登录了 如果登录了去掉注册与登录*/
            function initMy() {
                let fun = function () {
                    //获取本地保存的用户信息
                    var item = JSON.parse(localStorage.getItem('userLogin'));
                    //去除登录注册
                    $('#loginRegister').html('')
                    //修改头像地址
                    $('#headImg').prop('src', item.userInfo.infoHeadUrl)
                    //添加昵称
                    $('#nickname').html(item.userInfo.infoName)
                    //查看角色是不是商家 如果是商家入驻修改为商家后台管理
                    if (item.role.roleName == '商家') {
                        $('#role').text('店铺管理')
                    }
                }
                initAjax('/index/inspection', 'post', '', 'json', fun);
            }
            $(function () {
                //点击店铺
                $('#shopInfo').click(function () {
                    var item = JSON.parse(localStorage.getItem('userLogin'));
                    //证明已经登录了
                    if (item!=null){
                        //如果是商家 跳转商家后台
                        if ( item.role.roleName=='商家'){

                        }else {
                            location = '/OrderSkip/orderRegister'
                        }
                    }else {
                        $.toast("未登录 帮你转到登录页面", "cancel");
                        location = '/myPage/login'
                    }
                })
            })
        </script>
    </body>
</html>